package cn.yy.pojo;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Sale entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "sale", catalog = "phoneerp")
public class Sale implements java.io.Serializable {

	// Fields

	private Integer saleId;
	private Client client;
	private Date saleDate;
	private Double saleUnitPrice;
	private Integer saleAmount;
	private Integer saleProductId;
	private Double saleTotalPrice;
	private String isInvoiceNeed;
	private Double taxRate;
	private Double taxCount;
	private Double taxPlusTotalPrice;
	private Integer saleEmpId;
	private Integer areaId;
	private Integer feesId;
	private Integer isConfirm;
	private Set<Recipt> recipts = new HashSet<Recipt>(0);

	// Constructors

	/** default constructor */
	public Sale() {
	}

	/** minimal constructor */
	public Sale(Client client, Date saleDate, Double saleUnitPrice,
			Integer saleAmount, Integer saleProductId, Double saleTotalPrice,
			String isInvoiceNeed, Double taxRate, Double taxCount,
			Double taxPlusTotalPrice, Integer saleEmpId, Integer areaId,
			Integer feesId, Integer isConfirm) {
		this.client = client;
		this.saleDate = saleDate;
		this.saleUnitPrice = saleUnitPrice;
		this.saleAmount = saleAmount;
		this.saleProductId = saleProductId;
		this.saleTotalPrice = saleTotalPrice;
		this.isInvoiceNeed = isInvoiceNeed;
		this.taxRate = taxRate;
		this.taxCount = taxCount;
		this.taxPlusTotalPrice = taxPlusTotalPrice;
		this.saleEmpId = saleEmpId;
		this.areaId = areaId;
		this.feesId = feesId;
		this.isConfirm = isConfirm;
	}

	/** full constructor */
	public Sale(Client client, Date saleDate, Double saleUnitPrice,
			Integer saleAmount, Integer saleProductId, Double saleTotalPrice,
			String isInvoiceNeed, Double taxRate, Double taxCount,
			Double taxPlusTotalPrice, Integer saleEmpId, Integer areaId,
			Integer feesId, Integer isConfirm, Set<Recipt> recipts) {
		this.client = client;
		this.saleDate = saleDate;
		this.saleUnitPrice = saleUnitPrice;
		this.saleAmount = saleAmount;
		this.saleProductId = saleProductId;
		this.saleTotalPrice = saleTotalPrice;
		this.isInvoiceNeed = isInvoiceNeed;
		this.taxRate = taxRate;
		this.taxCount = taxCount;
		this.taxPlusTotalPrice = taxPlusTotalPrice;
		this.saleEmpId = saleEmpId;
		this.areaId = areaId;
		this.feesId = feesId;
		this.isConfirm = isConfirm;
		this.recipts = recipts;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "saleId", unique = true, nullable = false)
	public Integer getSaleId() {
		return this.saleId;
	}

	public void setSaleId(Integer saleId) {
		this.saleId = saleId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "clientId", nullable = false)
	public Client getClient() {
		return this.client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "saleDate", nullable = false, length = 10)
	public Date getSaleDate() {
		return this.saleDate;
	}

	public void setSaleDate(Date saleDate) {
		this.saleDate = saleDate;
	}

	@Column(name = "saleUnitPrice", nullable = false, precision = 22, scale = 0)
	public Double getSaleUnitPrice() {
		return this.saleUnitPrice;
	}

	public void setSaleUnitPrice(Double saleUnitPrice) {
		this.saleUnitPrice = saleUnitPrice;
	}

	@Column(name = "saleAmount", nullable = false)
	public Integer getSaleAmount() {
		return this.saleAmount;
	}

	public void setSaleAmount(Integer saleAmount) {
		this.saleAmount = saleAmount;
	}

	@Column(name = "saleProductId", nullable = false)
	public Integer getSaleProductId() {
		return this.saleProductId;
	}

	public void setSaleProductId(Integer saleProductId) {
		this.saleProductId = saleProductId;
	}

	@Column(name = "saleTotalPrice", nullable = false, precision = 22, scale = 0)
	public Double getSaleTotalPrice() {
		return this.saleTotalPrice;
	}

	public void setSaleTotalPrice(Double saleTotalPrice) {
		this.saleTotalPrice = saleTotalPrice;
	}

	@Column(name = "isInvoiceNeed", nullable = false, length = 4)
	public String getIsInvoiceNeed() {
		return this.isInvoiceNeed;
	}

	public void setIsInvoiceNeed(String isInvoiceNeed) {
		this.isInvoiceNeed = isInvoiceNeed;
	}

	@Column(name = "taxRate", nullable = false, precision = 22, scale = 0)
	public Double getTaxRate() {
		return this.taxRate;
	}

	public void setTaxRate(Double taxRate) {
		this.taxRate = taxRate;
	}

	@Column(name = "taxCount", nullable = false, precision = 22, scale = 0)
	public Double getTaxCount() {
		return this.taxCount;
	}

	public void setTaxCount(Double taxCount) {
		this.taxCount = taxCount;
	}

	@Column(name = "taxPlusTotalPrice", nullable = false, precision = 22, scale = 0)
	public Double getTaxPlusTotalPrice() {
		return this.taxPlusTotalPrice;
	}

	public void setTaxPlusTotalPrice(Double taxPlusTotalPrice) {
		this.taxPlusTotalPrice = taxPlusTotalPrice;
	}

	@Column(name = "saleEmpId", nullable = false)
	public Integer getSaleEmpId() {
		return this.saleEmpId;
	}

	public void setSaleEmpId(Integer saleEmpId) {
		this.saleEmpId = saleEmpId;
	}

	@Column(name = "areaId", nullable = false)
	public Integer getAreaId() {
		return this.areaId;
	}

	public void setAreaId(Integer areaId) {
		this.areaId = areaId;
	}

	@Column(name = "feesId", nullable = false)
	public Integer getFeesId() {
		return this.feesId;
	}

	public void setFeesId(Integer feesId) {
		this.feesId = feesId;
	}

	@Column(name = "isConfirm", nullable = false)
	public Integer getIsConfirm() {
		return this.isConfirm;
	}

	public void setIsConfirm(Integer isConfirm) {
		this.isConfirm = isConfirm;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "sale")
	public Set<Recipt> getRecipts() {
		return this.recipts;
	}

	public void setRecipts(Set<Recipt> recipts) {
		this.recipts = recipts;
	}

}